package boun.center;

import java.io.Serializable;
import java.util.ArrayList;


public class BusSchedule implements Serializable {
    private static final long serialVersionUID = 1L;
    private String[] locations;
    private LineSchedule[] lineSchedule = new LineSchedule[2];;
    private String lineCode;
    private String roundTripTime;
    
    public enum Direction { FROM_LOCATION1_TO_LOCATION2, FROM_LOCATION2_TO_LOCATION1 };
    public enum DayType { WEEK_DAY, WEEK_END, HOLIDAY };
    
    public BusSchedule(String lineCode, String firstLocation, String secondLocation, String roundTripTime) {
        this.lineCode = lineCode;
        this.locations = new String[2];
        this.locations[0] = firstLocation;
        this.locations[1] = secondLocation;
        this.lineSchedule[0] = new LineSchedule();
        this.lineSchedule[1] = new LineSchedule();
        this.roundTripTime = roundTripTime;
    }
    
    public String[] getLocations() {
        return locations;
    }

    public String getLineCode() {
        return lineCode;
    }

    public String getRoundTripTime() {
        return roundTripTime;
    }

    public ArrayList<String> getDailyTimes(Direction direction, DayType dayType) {
        int index = direction == Direction.FROM_LOCATION1_TO_LOCATION2 ? 0 : 1;
        return this.lineSchedule[index].getDailyTimes(dayType);
    }
    
    public void insertDailyTime(Direction direction, DayType dayType, String time) {
        int index = direction == Direction.FROM_LOCATION1_TO_LOCATION2 ? 0 : 1;
        this.lineSchedule[index].insertDailyTime(dayType, time);
    }
    
}
